package com.wpl.oss.controller;

import com.wpl.R;
import com.wpl.oss.service.OssService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/oss/fileoss")
@Api("oss测验")
public class OssController {
    @Autowired
    private OssService ossService;
    @PostMapping
    public R uploadFiles(MultipartFile file) throws IOException {
        String url = ossService.uploadFiles(file);
        return R.ok().data("url",url);
    }
}
